package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MealMapper;
import com.ruoyi.system.domain.Meal;
import com.ruoyi.system.service.IMealService;

/**
 * 就餐Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-01
 */
@Service
public class MealServiceImpl implements IMealService 
{
    @Autowired
    private MealMapper mealMapper;

    /**
     * 查询就餐
     * 
     * @param mealId 就餐主键
     * @return 就餐
     */
    @Override
    public Meal selectMealByMealId(Long mealId)
    {
        return mealMapper.selectMealByMealId(mealId);
    }

    /**
     * 查询就餐列表
     * 
     * @param meal 就餐
     * @return 就餐
     */
    @Override
    public List<Meal> selectMealList(Meal meal)
    {
        return mealMapper.selectMealList(meal);
    }

    /**
     * 新增就餐
     * 
     * @param meal 就餐
     * @return 结果
     */
    @Override
    public int insertMeal(Meal meal)
    {
        meal.setCreateTime(DateUtils.getNowDate());
        return mealMapper.insertMeal(meal);
    }

    /**
     * 修改就餐
     * 
     * @param meal 就餐
     * @return 结果
     */
    @Override
    public int updateMeal(Meal meal)
    {
        meal.setUpdateTime(DateUtils.getNowDate());
        return mealMapper.updateMeal(meal);
    }

    /**
     * 批量删除就餐
     * 
     * @param mealIds 需要删除的就餐主键
     * @return 结果
     */
    @Override
    public int deleteMealByMealIds(Long[] mealIds)
    {
        return mealMapper.deleteMealByMealIds(mealIds);
    }

    /**
     * 删除就餐信息
     * 
     * @param mealId 就餐主键
     * @return 结果
     */
    @Override
    public int deleteMealByMealId(Long mealId)
    {
        return mealMapper.deleteMealByMealId(mealId);
    }
}
